<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<% pageContext.setAttribute("ctx", request.getContextPath()); %>
<html>
<head>
    <meta charset="UTF-8">
    <title>注册</title>

    <style>
        * { margin: 0; padding: 0; }
        html { height: 100%; }
        body { height: 100%; background: #fff url(${ctx}/images/bg1.jpg) 50% 50% no-repeat; background-size: cover;}
        .dowebok {background: #000; position: absolute; left: 50%; top: 50%; width: 430px; height:650px;  margin: -300px 0 0 -215px; border: 1px solid #000; border-radius: 20px; overflow: hidden;}
        .logo { width: 104px; height: 104px; margin: 50px auto 80px; background: url(${ctx}/images/login.png) 0 0 no-repeat; }
        .form-item { position: relative; width: 380px; margin: 0 auto; padding-bottom: 30px;}
        input {background-color: red; width: 360px; height: 50px; padding-left: 20px; border: 1px solid #fff; border-radius: 25px; font-size: 18px; color: #fff; background-color: #000; outline: none;}
        .form-item button { width: 360px; height: 50px; border: 0; border-radius: 25px; font-size: 18px; color: #000; outline: none; cursor: pointer; background-color: #fff; }
        select {width: 360px; height: 50px; border: 0;  font-size: 18px; padding-left: 20px;color: #fff; outline: none;border-radius: 25px; cursor: pointer; background-color: #000;border: 1px solid #fff; }
        table {color:#fff;font-size:20px;text-align:center; width: 400px; }
        @media screen and (max-width: 500px) {
            * { box-sizing: border-box; }
            .dowebok { position: static; width: auto; height: auto; margin: 0 30px; border: 0; border-radius: 0; }
            .logo { margin: 50px auto; }
            .form-item { width: auto; padding-top:20px;}
            .form-item input, .form-item button, .reg-bar { width: 100%; }
        }
        .myinput { width: 150px; height: 35px;  border: 2px solid #fff;  font-size: 14px;text-align:center;  }
    </style>
    <script>
        function check(){
            var regmSid = /^[0-9_]+$/;
            var regmSname = /^[\u4e00-\u9fa5]{0,}$/;
            var regmPassword = /^\w{5,17}$/;
            if(form.aId.value==""){
                alert("用户编号不能为空！");
                form.aId.focus();
                return false;
            }
            if(!form.aId.value.match(regmSid)){
                alert("用户编号格式不对，请使用数字！");
                form.aId.focus();
                return false;
            }
            if(form.password.value==""){
                alert("密码不能为空！");
                form.password.focus();
                return false;
            }
            if(!form.password.value.match(regmPassword)){
                alert("密码名格式不正确，长度在6~18之间，只能包含字母、数字和下划线！");
                form.password.focus();
                return false;
            }
            if(form.cfmpassword.value==""){
                alert("密码不能为空！");
                form.cfmpassword.focus();
                return false;
            }
            if(!form.cfmpassword.value.match(regmPassword)){
                alert("密码名格式不正确,密码以字母开头，长度在6~18之间，只能包含字母、数字和下划线！");
                form.cfmpassword.focus();
                return false;
            }
            if(form.password.value!= form.cfmpassword.value){
                alert("密码不一致！请重新输入！");
                form.cfmpassword.value="";
                form.cfmpassword.focus();
                return false;
            }
        }
    </script>
</head>
<body>
<%--<%--%>
<%--    String errorInfo = (String) session.getAttribute("msg2");--%>

<%--    if(errorInfo!=null){--%>
<%--%>--%>
<%--<script type="text/javascript" language="JavaScript">--%>
<%--    alert("<%=errorInfo %>");--%>
<%--</script>--%>
<%--<%--%>
<%--    }--%>
<%--%>--%>
<%--<%--%>
<%--    String errorInfo2 = (String) session.getAttribute("msg3");--%>
<%--    if(errorInfo2!=null){--%>
<%--%>--%>
<%--<script type="text/javascript" language="JavaScript">--%>
<%--    alert("<%=errorInfo2 %>");--%>
<%--</script>--%>
<%--<%--%>
<%--    }--%>
<%--%>--%>
<form name="form" action="${ctx}/admin/reg" method="post">


    <div class="dowebok">

        <div class="logo"></div>
        <span style="color: red"><h3>${requestScope.msg}</h3></span>
        <div class="form-item">
            <input type="text" name="aId" placeholder="请输入用户ID">
        </div>
        <div class="form-item">
            <input type="password" name="password" placeholder="请输入密码">
        </div>
        <div class="form-item">
            <input type="password" name="cfmpassword" placeholder="请输入确认密码">
        </div>
        <div class="form-item">

            <select name="permissions">

                <option value="1" class="break">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;学生</option>
                <option value="2" class="break">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;老师</option>
                <option value="3" class="break">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;管理</option>
            </select>

        </div>

        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input class="myinput" type="submit" value="注册" onClick="return check();" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input class="myinput" type="Reset" value="重置&nbsp;&nbsp;&nbsp;&nbsp;"/>
    </div>

</form>
</body>
</html>
